package com.xsir.ditan.admin.controller;

import com.xsir.ditan.admin.service.IMenuService;
import com.xsir.ditan.admin.vo.MenuListVo;
import com.xsir.ditan.common.config.SystemConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * @author user
 * @date 2021/2/2
 */
@Slf4j
@Controller
public class IndexController {
    @Autowired
    private IMenuService menuService;
    
    /**
     * 首页
     */
    @GetMapping({ "/", "/index" })
    public String index(Model model) {
        List<MenuListVo> menuListVo = menuService.getNavMenu();
        model.addAttribute("menuList", menuListVo);
        model.addAttribute("fullName", SystemConfig.fullName);
        model.addAttribute("nickName", SystemConfig.nickName);
        model.addAttribute("version", SystemConfig.version);
        
        return "index";
    }
    
    /**
     * 主页
     */
    @GetMapping("/main")
    public String main(Model model) {
        
        return "main";
    }
    
}
